//package com.t235.gc.order.utils;
//
//import org.apache.poi.hssf.usermodel.*;
//import org.apache.poi.ss.usermodel.*;
//import org.apache.poi.ss.util.CellRangeAddress;
//
//import javax.servlet.ServletOutputStream;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//import java.util.List;
//
//public class ExcelUtil {
//    public static void export(List<Object> dataList, HttpServletResponse response) throws IOException {
///**
// * 多态实现
// * HSSFWorkbook  是对于xls进行操作
// */
//        Workbook wb=new HSSFWorkbook();//新建一个工作簿
//        //FileOutputStream fout=new FileOutputStream("E:\\excel\\poi.xls");
//        response.setContentType("octets/stream");
//        response.setHeader("Content-Disposition", "attachment;filename="+System.currentTimeMillis()+".xls");
//        ServletOutputStream fout=response.getOutputStream();
//        Sheet sheet= wb.createSheet("第一个sheet页");//创建一个sheet页
//        HSSFCellStyle cellStyle = (HSSFCellStyle) wb.createCellStyle();
//        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);//垂直居中
//        cellStyle.setAlignment(HorizontalAlignment.CENTER);
//        //在第0行创建rows  (表标题)
//        HSSFRow title = (HSSFRow) sheet.createRow((int) 0);
//        HSSFCell cellValue = title.createCell(0);
//        cellValue.setCellValue("手游应用列表");
//        cellValue.setCellStyle(cellStyle);
//        sheet.addMergedRegion(new CellRangeAddress(0,0,0,(dataList.size()-1)));
//        //设置表头样式，表头居中
//        HSSFCellStyle style = (HSSFCellStyle) wb.createCellStyle();
//        //设置字体
//        HSSFFont font = (HSSFFont) wb.createFont();
//        font.setBold(true);
//        style.setFont(font);
//        style.setAlignment(HorizontalAlignment.RIGHT);
//        //在第1行创建rows
//        HSSFRow rows = (HSSFRow) sheet.createRow((int) 1);
//        //设置列头元素
//        HSSFCell cellHead = null;
//        String[] heardList={"id","手游名称","APK名称","所属平台","所属分类","状态","软件大小","下载次数","最新版本号"};
//        for (int i = 0; i < heardList.length; i++){
//            cellHead = rows.createCell(i);
//            cellHead.setCellValue(heardList[i]);
//            cellHead.setCellStyle(style);
//        }
//        for(int i=2;i<dataList.size()+2;i++){
////            AppInfo appInfo=dataList.get(i-2);
////            Row row=sheet.createRow(i);
////            int j=0;
////            row.createCell(j++).setCellValue(appInfo.getId());
////            row.createCell(j++).setCellValue(appInfo.getSoftwareName());
////            row.createCell(j++).setCellValue(appInfo.getApkName());
////            row.createCell(j++).setCellValue(appInfo.getFlatformName());
////            row.createCell(j++).setCellValue(appInfo.getCategoryLevel1Name()+"-->"+appInfo.getCategoryLevel2Name()+"-->"+appInfo.getCategoryLevel3Name());
////            row.createCell(j++).setCellValue(appInfo.getStatusName());
////            row.createCell(j++).setCellValue(appInfo.getSoftwareSize().toString());
////            row.createCell(j++).setCellValue(appInfo.getDownloads());
////            row.createCell(j++).setCellValue(appInfo.getVersionName());
//        }
//        wb.write(fout);//Workbook提供了write的方法
//        fout.close();//将输出流关闭
//    }
//}
